from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth.views import login as login_view
from django.contrib.auth.views import logout as logout_view
from django.core.urlresolvers import reverse_lazy

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/relatorio/$', 'apps.pizzasys.views.relatorio', name='relatorio'), 
    url(r'^admin/', include(admin.site.urls)),
    
    url(r'^chaining/', include('smart_selects.urls')),
    
    url(r'^cadastro/$', 'apps.pizzasys.views.cadastro', name='cadastro'),
    url(r'^entrar/$', login_view, name='login'),
    url(r'^sair/$', logout_view, {'next_page': reverse_lazy('index')}, 
        name='logout'),
    
    url(r'^$', 'apps.pizzasys.views.index', name='index'),
    
    ############################################################################
    
    url(r'^pedido/$','apps.pizzasys.views.fazer_pedido', name='fazer_pedido'),
    
    url(r'^pedido/pizza/$','apps.pizzasys.views.adicionar_pizza', name='adicionar_pizza'),
    url(r'^pedido/pizza/(?P<pk>\d+)$','apps.pizzasys.views.editar_pizza', name='editar_pizza'),
    url(r'^pedido/pizza/(?P<pk>\d+)/remover$','apps.pizzasys.views.remover_pizza', name='remover_pizza'),
    
    url(r'^pedido/outro/$','apps.pizzasys.views.adicionar_item', name='adicionar_item'),
    url(r'^pedido/outro/(?P<pk>\d+)$','apps.pizzasys.views.editar_item', name='editar_item'),
    url(r'^pedido/outro/(?P<pk>\d+)/remover$','apps.pizzasys.views.remover_item', name='remover_item'),
    
    url(r'^pedido/confirmar/$','apps.pizzasys.views.confirmar_pedido', name='confirmar_pedido'),
    url(r'^pedido/cancelar/$','apps.pizzasys.views.cancelar_pedido', name='cancelar_pedido'),
    url(r'^pedido/acompanhar/$','apps.pizzasys.views.acompanhar_pedido', name='acompanhar_pedido'),
    
    ############################################################################

    url(r'^sobre/$','apps.pizzasys.views.sobre', name='sobre'),
    url(r'^cardapio/$','apps.pizzasys.views.cardapio', name='cardapio'),
    url(r'^contato/$','apps.pizzasys.views.contato', name='contato'),
    
    
)
